<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <script text="javascript">
        function recargar() {
            //se activa el método alert luego de 2 segundos
            //setTimeout("alert('Pasaron 2 segundos!')",2000); 10000
            setTimeout('document.location.reload()', 1000);
        }
    </script>

    <ui:composition template="/template.xhtml">
        <ui:define name="body" >
            <p:growl id="growl" showDetail="true"/>
            <p:panel header=" Lista de Expedientes Registrados"  > 
                <h:form styleClass="jsfcrud_list_form" prependId="false" id="frm_exped" >
                    <h:panelGroup id="messagePanel" layout="block" >
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:panelGrid id="pnl1" columns="3"> 
                        <h:outputText value="Expedientes del Dia " style="color: red;" /> 
                        <p:calendar value="#{expedienteController.fecha_emision}" size="7" id="popupButtonCal" showOn="button" locale="es" onclick="recargar();" />  
                    </h:panelGrid>
                    <p:separator /> 
                    <p:commandButton value="Listar Expedientes del Dia " action="#{expedienteController.Filtrar_lista_Fecha}"  update="frm_exped"/>
                    <br /> 
                    <p:separator />

                    <h:outputText escape="false" value="#{bundle.ListExpedienteEmpty}" rendered="#{expedienteController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{expedienteController.items.rowCount > 0}">

                        <h:outputText value="#{expedienteController.pagination.pageFirstItem + 1}..#{expedienteController.pagination.pageLastItem + 1}/#{expedienteController.pagination.itemsCount}"/>&nbsp;
                        <h:commandLink action="#{expedienteController.previous}" value="#{bundle.Previous} #{expedienteController.pagination.pageSize}" rendered="#{expedienteController.pagination.hasPreviousPage}"/>&nbsp;
                        <h:commandLink action="#{expedienteController.next}" value="#{bundle.Next} #{expedienteController.pagination.pageSize}" rendered="#{expedienteController.pagination.hasNextPage}"/>&nbsp;

                        <p:dataTable value="#{expedienteController.lista}" var="item" id="dataTable" scrollable="true" scrollHeight="200"  widgetVar="expTable"
                                     paginator="true" rows="10"   filteredValue="#{tableBean.filteredCars}"
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10" rowKey="#{item.codExp}" selection="#{expedienteController.expedient}" selectionMode="single"
                                     >

                            <f:facet name="header">  
                                <p:outputPanel>  
                                    <h:outputText value="Busca Expedientes:" />  
                                    <p:inputText id="globalFilter" onkeyup="PF('expediente').filter()" style="width:150px" />  
                                </p:outputPanel>  
                            </f:facet>  

                            <p:column width="65" style="text-align: center"> 
                                <f:facet name="header"><h:outputText value="Exped"/></f:facet>
                                <h:outputText value="#{item.codExp}"/>
                            </p:column>
                            <p:column width="60">
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_fechaReg}"/></f:facet>
                                <h:outputText value="#{item.fechaReg}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                    <!--f:convertDateTime pattern="MM/dd/yyyy" /-->
                                </h:outputText>
                            </p:column>
                            <p:column width="50">
                                <f:facet name="header" ><h:outputText value="Nº Exped."/></f:facet>
                                <h:outputText value="#{item.numexpeIngr}"/>
                            </p:column>
                            <p:column style="text-align: left" width="120">
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_asunto}"/></f:facet>
                                <h:outputText value="#{item.asunto}"/>
                            </p:column>
                            <p:column width="40" style="text-align: center">
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_folios}"/></f:facet>
                                <h:outputText value="#{item.folios}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_remitente}"/></f:facet>
                                <h:outputText value="#{item.remitente}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_detalleExpe}"/></f:facet>
                                <h:outputText value="#{item.detalleExpe}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_fkCodificador}"/></f:facet>
                                <h:outputText value="#{item.fkCodificador}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_observac}"/></f:facet>
                                <h:outputText value="#{item.observac}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_proveido}"/></f:facet>
                                <h:outputText value="#{item.proveido}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_interesArea}"/></f:facet>
                                <h:outputText value="#{item.interesArea}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_tipoTramite}"/></f:facet>
                                <h:outputText value="#{item.tipoTramite}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_tipoDocTra}"/></f:facet>
                                <h:outputText value="#{item.tipoDocTra}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_tipoPriorida}"/></f:facet>
                                <h:outputText value="#{item.tipoPriorida}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header"><h:outputText value="#{bundle.ListExpedienteTitle_inmuebles}"/></f:facet>
                                <h:outputText value="#{item.inmuebles}"/>
                            </p:column> 
                            <p:column>
                                <f:facet name="header"><h:outputText value="Opciones&nbsp;"/></f:facet>
                                <h:commandLink action="#{expedienteController.prepareView}" value="#{bundle.ListExpedienteViewLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{expedienteController.prepareEdit}" value="#{bundle.ListExpedienteEditLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{expedienteController.destroy}" value="#{bundle.ListExpedienteDestroyLink}"/>
                            </p:column>
                            <p:column style="width:60px; text-align: center;" headerText="op.">
                                <!--p:commandButton value="ver" image="ui-icon ui-icon-search"  oncomplete="expDialog.show()" /-->
                                <p:commandButton value="ver" image="ui-icon ui-icon-search"  />
                            </p:column >
                        </p:dataTable>


                    </h:panelGroup> 
                    <br />
                    <h:commandLink action="#{expedienteController.prepareCreate}" value="#{bundle.ListExpedienteCreateLink}"/>
                    <br />
                    <br />
                    <h:link outcome="/index" value="#{bundle.ListExpedienteIndexLink}"/>
                </h:form>
            </p:panel>


        </ui:define>
    </ui:composition>

</html>
